<h1>Curve</h1>

<p>Curved lines are constructed using a Quadratic Bezier curve. The curve is 
specified using two points relative to the current drawing position, an off-curve 
control point and an on-curve anchor point which defines the end-point of the 
curve.</p>

<img src="quadratic.gif">

<p>To define a curve the points are defined as pairs of relative coordinates. The 
control point is specified relative to the current drawing point and the anchor 
point is specified relative to the control point. Once the line is drawn, the 
anchor point becomes the current drawing point.</p>

<table>

<tr>
<th nowrap>Field Name</th>
<th>Type</th>
<th>Size</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top">type</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">2</td>
<td>Identifies a curve or a line when included in the drawing commands that 
describe a shape. 0 = style information, 2 = curve or 3 = line.</td>
</tr>

<tr>
<td nowrap valign="top">size</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">4</td>
<td>The number of bits in each x and y coordinate used to describe the curve. The 
actual number of bits is size+2 which increases the dynamic range of the coordinates
being encoded.</td>
</tr>

<tr>
<td nowrap valign="top">cx</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">&lt;size&gt;+2</td>
<td>The x-coordinate, relative to the current drawing point, of the off-curve 
control point.</td>
</tr>

<tr>
<td nowrap valign="top">cy</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">&lt;size&gt;+2</td>
<td>The y-coordinate, relative to the current drawing point, of the off-curve 
control point.</td>
</tr>

<tr>
<td nowrap valign="top">ax</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">&lt;size&gt;+2</td>
<td>The x-coordinate, relative to the control point, of the on-curve anchor
point at the end of the curve.</td>
</tr>

<tr>
<td nowrap valign="top">ay</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">&lt;size&gt;+2</td>
<td>The y-coordinate, relative to the control point, of the on-curve anchor
point at the end of the curve.</td>
</tr>

</table>

<p>The relative coordinates are specified in twips (where 20 twips = 1 pixel). 
Using an increment of 2 to the size field gives a range for expressing relative
coordinates of -65536..65535.</p>

<p>Flash does not directly support Cubic Bezier curves. Converting a Cubic 
Bezier curve to a Quadratic curve is a non trivial process, however algorithms
are avialable which can provide accurate approximations so the visual results 
are equivalent.</p>

<h2>History</h2>

<p>The Curve data structure represents the CurvedEdge record from the Macromedia 
Flash (SWF) File Format Specification. It was introduced in Flash 1.</p>
